package uk.ac.lkl.lpp.model;



import java.util.List;


/**
 * Single field: the elements of the list itself.
 * 
 * @author Darren Pearce
 * @version $Revision$
 * @version $Date$
 * 
 */
public abstract class ListFieldGroup<O> extends FieldGroup<O> {

    private Class<O> cl;


    public ListFieldGroup(List<O> list,
            Class<O> cl) {
        super(list);
        this.cl = cl;
    }


    @Override
    protected final Object getField(int listIndex, O element, int fieldIndex) {
        return element;
    }


    protected void setField(O element, int fieldIndex, Object object) {
        // todo: set element
    }


    public abstract String getFieldName(int fieldIndex);


    protected final Class getClass(int fieldIndex) {
        return cl;
    }


    public final int size() {
        return 1;
    }

}
